﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript事件</title>
</head>
<body>
    <select id="select_www" onchange="surf()">
        <option value="0" selected="selected">请选择</option>
        <option value="http://www.baidu.com">百度</option>
        <option value="http://www.163.com">网易</option>
        <option value="http://www.qq.com">qq</option>
        <option value="http://www.sina.com.cn">新浪</option>
    </select>
    <input type="text" id="textbox">
    <button value="" id="button_www" onclick="jump()">确认跳转</button>
</body>
<script type="text/javascript">

    function surf() {
        select = document.getElementById("select_www").value;
        switch (select) {
            case "http://www.baidu.com":
                document.getElementById("textbox").value = "http://www.baidu.com";
                break;
            case "http://www.163.com":
                document.getElementById("textbox").value = "http://www.163.com";
                break;
            case "http://www.qq.com":
                document.getElementById("textbox").value = "http://www.qq.com";
                break;
            case "http://www.sina.com.cn":
                document.getElementById("textbox").value = "http://www.sina.com.cn";
                break;
        }
    }
    function jump() {
        location = document.getElementById("textbox").value;
    }
</script>
</html>